#import "DictionaryUtil.h"

@implementation CDictionaryUtil

+(void)SetIntValue:(NSMutableDictionary*)aDictionary tagKey:(NSString*)aKey tagIntValue:(int)aValue
{
	NSNumber *number;
	if(aDictionary&&aKey)
	{
		number=[NSNumber numberWithInt:aValue];
		[aDictionary setObject:number forKey:aKey];
	}
}
+(void)SetPointerValue:(NSMutableDictionary*)aDictionary tagKey:(NSString*)aKey tagPointerValue:(void*)aValue
{
	NSValue *pValue;
	if(aDictionary&&aKey)
	{
		pValue=[NSValue valueWithPointer:aValue];
		[aDictionary setObject:pValue forKey:aKey];

	}
}

+(int)GetIntValue:(NSDictionary*)aDictionary tagKey:(NSString*)aKey
{
	NSNumber *number;
	int value;
	value=0;
	if(aDictionary&&aKey)
	{
		number=(NSNumber*)[aDictionary objectForKey:aKey];
		if(number)
		value=[number intValue];
	}
	return value;
}
+(void*)GetPointerValue:(NSDictionary*)aDictionary tagKey:(NSString*)aKey
{
	NSValue *pValue;
	char *value;
	value=NULL;
	if(aDictionary&&aKey)
	{
		pValue=(NSValue*)[aDictionary objectForKey:aKey];
		if(pValue)
		value=[pValue pointerValue];
	}
	return value;
}

@end
